#include <stdio.h>
#include <stdlib.h>
#include "cargar.h"
/*
char *cargar(int len, char *p)
{
	p=(char *)malloc(sizeof(char));
	p=fgets(p,len,stdin);
	
	return p;
	
	
}*/

char *cargar(int len)
{
  char *p;
  char c;/*=NULL;*/
  int i=1;
  
  p=(char*)malloc(sizeof(char));
  scanf("%c",&c);
  while (c=='\n')
    {
    scanf("%c",&c);
    }
 
  /*  scanf("%c",&c);*/
  *p=c;
  i++;

  while(i<=len && c!='\n')
    {
      p=(char*)realloc(p,sizeof(char)*i);
      scanf("%c",&c);
      p[i-1]=c;
      i++;
    }
  /*  p=(char*)realloc(p,sizeof(char)*i);*/
  p[i-2]='\0';

  return p;
      
}


